Skip to content

fix: empty initial direct edit value for elements with null declared name#2312

Open
mvanhorn wants to merge 1 commit into
eclipse-syson:mainfrom
mvanhorn:fix/2221-explorer-direct-edit-null-name
Open

fix: empty initial direct edit value for elements with null declared name#2312
mvanhorn wants to merge 1 commit into
eclipse-syson:mainfrom
mvanhorn:fix/2221-explorer-direct-edit-null-name

Conversation

@mvanhorn

Copy link
Copy Markdown

Summary

Triggering a direct edit in the SysON Explorer on an element with no declared name (for example a Dependency) now presents an empty initial value instead of the computed display label.

In SysONExplorerInitialDirectEditTreeItemLabelProvider.handle, the resolved element was mapped through Element::getDeclaredName. When that returned null, Optional.map collapsed to an empty Optional and execution fell through to the tree-item label fallback. Validating that prefilled label then wrote the display label into the element's declared name, which could create a duplicated short name. When an Element is resolved, the provider now returns its declared name, or an empty string when it is null. The tree-item label fallback is kept only for the case where no Element is resolved at all.

Testing

Added testDirectEditOnElementWithNullDeclaredName to ExplorerViewControllerIntegrationTests, backed by a new RequirementUsage fixture in ExplorerView-DirectEdit.sql that has a short name but no declared name. The test asserts the initial direct-edit value is an empty string. The existing testDirectEditOnElementWithShortName (declared name "") still passes.

Fixes #2221


PLEASE READ ALL ITEMS AND CHECK ONLY RELEVANT CHECKBOXES BELOW

Auto review

  • Have you reviewed this PR?

Project management

  • Has the pull request been added to the relevant milestone?
  • Have the priority: and pr: labels been added to the pull request?
  • Have the relevant issues been added to the pull request?
  • Have the relevant labels been added to the issues? (area:, type:)
  • Have the relevant issues been added to the same project milestone as the pull request?

Changelog and release notes

  • Has the CHANGELOG.adoc been updated to reference the relevant issues?
  • Have the relevant API breaks been described in the CHANGELOG.adoc? (no API break)
  • Are the new / upgraded dependencies mentioned in the relevant section of the CHANGELOG.adoc? (no dependency change)
  • In case of a change with a visual impact, are there any screenshots? (no visual change)

Documentation

  • Have you included an update of the documentation? (no documentation change needed)

Tests

  • Is the code properly tested?

@AxelRICHARD

Copy link
Copy Markdown
Member

Hello @mvanhorn,

Thank you for providing this PR

As mentioned in #2275, could you please add an entry to the CHANGELOG as required by the PR template?
Could you also signed the Eclipse Contributor Agreement (ECA) https://www.eclipse.org/legal/eca/ please ? I won't be able to merge the PR if you don't sign it.
You also need to follow this rule https://doc.mbse-syson.org/syson/v2026.5.0/developer-guide/index.html#_contribute_a_change_in_the_codebase about the commit message.

Please fix the other PR and this one.

Thank you.

…d name

The SysON Explorer initial direct-edit provider mapped the resolved
element through getDeclaredName(). When that returned null (for example
a Dependency), Optional.map collapsed to empty and the code fell back to
the computed tree-item label. Validating that prefilled label wrote the
display label into the declared name, creating a duplicated short name.

When an Element is resolved, return its declared name or an empty string
when it is null. The tree-item label fallback is kept only when no
Element resolves at all.

Bug: eclipse-syson#2221

Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
@mvanhorn mvanhorn force-pushed the fix/2221-explorer-direct-edit-null-name branch from ff7b4bf to d3cd731 Compare June 29, 2026 13:36
@AxelRICHARD AxelRICHARD added this to the 2026.7.0 milestone Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong initial direct edit value on elements with null declared name

2 participants